#include "mathematic.h"

const float Mathematic::M_PI = 3.14159265358979323846f;

Mathematic::Mathematic(void)
{
}


Mathematic::~Mathematic(void)
{
}


float Mathematic::toDegrees(float radians)
{
	float degrees = radians*180.0f/M_PI;

	return degrees;
}

float Mathematic::toRadians(float degrees)
{
	float radians = degrees*M_PI/180.0f;

	return radians;
}

Point3D Mathematic::CrossProduct(const Point3D& vec1, const Point3D& vec2)
{
	return Point3D(vec1.y*vec2.z - vec1.z*vec2.y, vec1.z*vec2.x - vec1.x*vec2.z, vec1.x*vec2.y - vec1.y*vec2.x);
}

Point3D Mathematic::Normalize(const Point3D& vec)
{
	float c = sqrt(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z); 

	return Point3D(vec.x/c,vec.y/c,vec.z/c);
}